<include file="Public/header"/>
        <div class="row">
            <div class="col-sm-12">
			<form class="layui-form" action="" id="profile">
			<input type="hidden" name="userid" value="<{$u.id}>">
			  <div class="layui-form-item">
				<label class="layui-form-label">用户名：</label>
				<div class="layui-input-inline">
				  <input type="text" name="u[username]" lay-verify="required" autocomplete="off"
						 value="<{$u.username}>"
						 placeholder="用户名"
						 class="layui-input"
						 <if condition="$u.id gt 0">disabled="disabled"</if>
						 >
				</div>
			  </div>
			  <div class="layui-form-item">
				<label class="layui-form-label">姓名：</label>
				<div class="layui-input-inline">
				  <input type="text" name="u[realname]" lay-verify="required" autocomplete="off"
						 value="<{$u.realname}>"
						 placeholder="姓名"
						 class="layui-input">
				</div>
			  </div>
			  <div class="layui-form-item">
				<label class="layui-form-label">性别：</label>
				<div class="layui-input-inline">
				  <select name="u[sex]" lay-search="">
					<option value=""></option>
					<option <if condition="$u['sex'] eq 0">selected</if> value="0">女</option>
					<option <if condition="$u['sex'] eq 1">selected</if> value="1">男</option>
				  </select>
				</div>
			  </div>
			  
			  <div class="layui-form-item">
				<label class="layui-form-label">身份证号：</label>
				<div class="layui-input-inline">
				  <input type="text" name="u[sfznumber]" lay-verify="required" autocomplete="off" value="<{$u.sfznumber}>" placeholder="身份证号" class="layui-input">
				</div>
			  </div>
			  <div class="layui-form-item">
				<label class="layui-form-label">出生日期：</label>
				<div class="layui-inline">
				  <input class="layui-input" name="u[birthday]" placeholder="出生日期" id="birthday" value="<{$u[birthday]|date="Y-m-d",###}>">
				</div>
			  </div>
			  
			  <div class="layui-form-item">
				<label class="layui-form-label">手机号码：</label>
				<div class="layui-input-inline">
				  <input type="text" name="u[mobile]" lay-verify="required" autocomplete="off" value="<{$u.mobile}>" placeholder="手机号码" class="layui-input">
				</div>
			  </div>
			  
			  <div class="layui-form-item">
				<label class="layui-form-label">联系QQ：</label>
				<div class="layui-input-inline">
				  <input type="text" name="u[qq]" autocomplete="off" value="<{$u.qq}>" placeholder="联系QQ"
						 class="layui-input">
				</div>
			  </div>
			  
			  <div class="layui-form-item">
				<label class="layui-form-label">Email：</label>
				<div class="layui-input-inline">
				  <input type="text" name="u[email]" lay-verify="required" autocomplete="off" value="<{$u.email}>" placeholder="Email" class="layui-input">
				</div>
			  </div>
			  
			  <div class="layui-form-item">
				<label class="layui-form-label">用户级别：</label>
				<div class="layui-input-inline">
				  <select name="u[groupid]" lay-verify="required" lay-search="">
					<option value=""></option>
						<foreach name="groupId" item="v" key="k">
	                      <option <if condition="$u['groupid'] eq $k">selected</if>
							  value="<{$k}>"><{$v}></option>
	                    </foreach>

				  </select>
				</div>
			  </div>
			  
			  <div class="layui-form-item">
				<label class="layui-form-label">联系地址：</label>
				<div class="layui-inline">
					<div class="layui-input-inline">
					  <input type="text" name="u[address]" lay-verify="required" autocomplete="off" value="<{$u.address}>" placeholder="联系地址" class="layui-input">
					</div>
				</div>
			</div>
			  <div class="layui-form-item">
				<div class="layui-input-block">
				  <button class="layui-btn" lay-submit="submit" lay-filter="save">提交保存</button>
				</div>
			  </div>
			</form>
            </div>
        </div>
<include file="Public/footer"/>
<script>
layui.use(['layer', 'form','laydate'], function(){
  var form = layui.form
  ,laydate = layui.laydate
  ,layer = layui.layer;

    //常规用法
    laydate.render({
        elem: '#birthday'
    });
  //监听提交
  form.on('submit(save)', function(data){
    $.ajax({
		url:"<{:U('User/saveUser')}>",
		type:"post",
		data:$('#profile').serialize(),
		success:function(res){
			if(res.status){
				layer.alert("编辑成功", {icon: 6},function () {
					parent.location.reload();
					var index = parent.layer.getFrameIndex(window.name);
					parent.layer.close(index);
				});
			}else{
                layer.alert("操作失败:" + res.msg, {icon: 5},function (index) {
                    layer.close(index)
                });
			}
		}
	});
    return false;
  });
});
</script>
<!--统计代码，可删除-->
</body>
</html>
